<!DOCTYPE html>
<html lang="zh">
<head>
    <meta charset="UTF-8">
    <title>系统后台首页</title>
    <link rel="stylesheet" href="/static/layui/css/layui.css" media="all" />
    <link rel="stylesheet" href="/static/css/public.css" media="all" />
</head>
<body class="childrenBody">
<blockquote class="layui-elem-quote layui-bg-gray layui-row">
    <div class="layui-col-xs12 layui-col-sm12 layui-col-md12 layui-col-lg12">
        <div class="layui-col-xs4 layui-col-sm4 layui-col-md2 layui-col-lg2 textfont">
            患者留言
        </div>
        <div id="sysTime" class="layui-col-xs8 layui-col-sm8 layui-col-md4 layui-col-lg4 layui-col-md-offset6 layui-col-lg-offset6 layui-col-xs-offset1 layui-col-sm-offset1" ></div>
    </div>
</blockquote>
<div>
    <ul id="message" class="layui-timeline">
    </ul>
</div>
</body>
<script type="text/javascript" src="/static/layui/layui.js"></script>
<script type="text/javascript">
    //获取系统时间
    var newDate = '';
    getLangDate();
    //值小于10时，在前面补0
    function dateFilter(date){
        if(date < 10){return "0"+date;}
        return date;
    }
    function getLangDate(){
        var obj = new Date(); //表示当前系统时间的Date对象
        var year = obj.getFullYear(); //当前系统时间的完整年份值
        var month = obj.getMonth()+1; //当前系统时间的月份值
        var date = obj.getDate(); //当前系统时间的月份中的日
        var day = obj.getDay(); //当前系统时间中的星期值
        var weeks = ["星期日","星期一","星期二","星期三","星期四","星期五","星期六"];
        var week = weeks[day]; //根据星期值，从数组中获取对应的星期字符串
        var hour = obj.getHours(); //当前系统时间的小时值
        var minute = obj.getMinutes(); //当前系统时间的分钟值
        var second = obj.getSeconds(); //当前系统时间的秒钟值
        var timeValue = "" +((hour >= 12) ? (hour >= 18) ? "晚上" : "下午" : "上午" ); //当前时间属于上午、晚上还是下午
        newDate = dateFilter(year)+"年"+dateFilter(month)+"月"+dateFilter(date)+"日 "+" "+dateFilter(hour)+":"+dateFilter(minute)+":"+dateFilter(second);
        document.getElementById("sysTime").innerHTML = timeValue+"好！欢迎使用医院挂号系统。当前时间为："+newDate+"　"+week;
        setTimeout("getLangDate()",1000);
    }

    layui.use(['form','element','layer','jquery','table'],function(){
        var form = layui.form,
            layer = parent.layer === undefined ? layui.layer : top.layer,
            element = layui.element;
        tab = layui.table;
        $ = layui.jquery;


        /**
         * 渲染反馈时间线
         */

            $.ajax({
                url:'/message/all',
                type:'GET',
                success:function (res) {
                    var str = "";
                    for (var data in res.data){
                        console.log(res.data[data])
                        str+= '<li class="layui-timeline-item">\n' +
                            '                <i class="layui-icon layui-timeline-axis">&#xe63f;</i>\n' +
                            '                <div class="layui-timeline-content layui-text">\n' +
                              '                    <h3 class="layui-timeline-title">'+res.data[data].patientNo+'号患者        '+ res.data[data].mesTime+'</h3>\n' +
                            '                    <p>\n' +
                            res.data[data].mesContext+
                            '                    </p>\n' +
                            '                </div>\n' +
                            '            </li>'
                    }
                    $("#message").html(str);
                }
            });
    });
</script>
</html>